<template>
  <div>
    <ymm-content title="用户详情">
      <user-card :user="$store.getters.user" @modify="show=true"></user-card>
    </ymm-content>
    <modify-dialog :show="show" @closeDialog="show=false" @handleSubmit="onUpdate"/>
  </div>
</template>

<script>
import YmmContent from "@/components/common/ymm-content";
import UserCard from "@/views/userDetail/user-card";
import ModifyDialog from "@/views/userDetail/modify-dialog";
import {updateDetail} from "@/api/system-user";

export default {
  data() {
    return {
      show: false,

    }
  },
  methods: {
    onUpdate(user) {
      updateDetail(user).then(res => {
        this.$message.success('修改成功')
        this.show = false
        this.$store.commit('user/CHANGE_USER', user)
      }).catch(err => {
      })
    }
  },
  components: {YmmContent, UserCard, ModifyDialog}
}
</script>

<style scoped lang="less">

</style>
